//
//  ViewController.swift
//  test
//
//  Created by bianruifeng on 2025/7/5.
//

import UIKit

class ViewController: UIViewController {
    var button: UIButton!
    var label: UILabel!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = .white
        // Do any additional setup after loading the view.
        
        label = UILabel()
        label.text = "首页"
        view.addSubview(label)
        label.snp.makeConstraints { make in
            make.center.equalToSuperview()
            make.trailing.lessThanOrEqualToSuperview().offset(-20)
        }
        // 录制按钮
        button = UIButton(type: .custom)
        view.addSubview(button)
        button.setTitle("去考试", for: .normal)
        button.backgroundColor = .red
        button.snp.makeConstraints { make in
            make.bottom.equalTo(view.safeAreaLayoutGuide).offset(-100)  // 相对于安全区域底部
            make.centerX.equalToSuperview()
            make.size.equalTo(CGSize(width: 100, height: 50))
        }
        
        button.addTarget(self, action: #selector(toggleRecording), for: .touchUpInside)
    }
    
    // 开始/停止录制
    @objc func toggleRecording() {
        self.navigationController?.pushViewController(VideoRecorderViewController(), animated: true)
        
    }
}

